package com.yuncheng.spcyApi.service.impl;

import org.apache.commons.lang3.StringUtils;
import com.yuncheng.spcyApi.constant.common.SpcyCommonConstant;
import com.yuncheng.spcyApi.constant.common.SpcyConstant;
import com.yuncheng.spcyApi.entity.SpcySqsxQywjcl;
import com.yuncheng.spcyApi.flow.SpcyFlowConstant;
import com.yuncheng.spcyApi.mapper.SpcySqsxQywjclMapper;
import com.yuncheng.spcyApi.service.ISpcySqsxQywjclService;
import com.yuncheng.spcyApi.utils.GetCurrentUserUtils;
import org.springframework.stereotype.Service;
import com.yuncheng.common.base.service.impl.BaseServiceImpl;
import javax.annotation.Resource;

/**
 * @Description: 审评查验-申请事项-企业文件材料
 * @Author: yuncheng
 * @Date: 2023-10-16
 * @Version: V1.0
 */
@Service
public class SpcySqsxQywjclServiceImpl extends BaseServiceImpl<SpcySqsxQywjclMapper, SpcySqsxQywjcl> implements ISpcySqsxQywjclService {

    @Resource
    private SpcySqsxQywjclMapper spcySqsxQywjclMapper;

//    @Async(value = "asyncSimpleTask")
    @Override
    public void updateQysqclFileYdzt(String id, String sqsxid, String fydzt, String fsfzxsc) {

        // 企业-不处理
        String currentUserOrgId = GetCurrentUserUtils.getCurrentUserOrgId();
        if (StringUtils.isNotBlank(currentUserOrgId) && currentUserOrgId.equals(SpcyConstant.QY_ORG_ID)){
            return;
        }

        // 中心上传-不处理
        if (StringUtils.isNotBlank(fsfzxsc) && fsfzxsc.equals(SpcyCommonConstant.QY_WJCL_SFZXSC_YES)){
            return;
        }

        if (StringUtils.isNotBlank(fydzt) && fydzt.equals(SpcyCommonConstant.QY_WJCL_YDZT_YD)) {
            return;
        }

        spcySqsxQywjclMapper.updateWjyd(id, SpcyCommonConstant.QY_WJCL_YDZT_YD, sqsxid, SpcyFlowConstant.HJMC_RWSL);

        /*LambdaUpdateWrapper<SpcySqsxQywjcl> wrapper = new LambdaUpdateWrapper<>();
        wrapper.eq(SpcySqsxQywjcl::getId, id);
//        wrapper.isNull(SpcySqsxQywjcl::getFsfzxsc);

        SpcySqsxQywjcl update = new SpcySqsxQywjcl();
        update.setFydzt(SpcyCommonConstant.QY_WJCL_YDZT_YD);
        update(update, wrapper);*/
    }
}
